package com.xio.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @Author: xio
 * @Description: 消息消费者控制层
 * @Date: 2020/10/13 18:46
 */
@Component
@EnableBinding(Sink.class)
@Slf4j
public class MessageListenerController {

    @Value("${server.port}")
    private String port;

    @StreamListener(Sink.INPUT)
    public void input(Message<String> message){
        log.info("- - - - - port:"+port +",消费者1号，接受消息："+message.getPayload());
    }

}
